/**
 * 
 */
package t4j.typeinfo.pets;

import java.util.ArrayList;
import java.util.List;

/**
 * @author sz
 *
 * create time：2012-12-14
 */
public class ForNameCreator extends PetCreator{

	private static List<Class<? extends Pet>> types = new ArrayList<Class<? extends Pet>>();
	
	private static String[] typeNames = {
		"t4j.typeinfo.pets.Mutt",
		"t4j.typeinfo.pets.Pug",
		"t4j.typeinfo.pets.EgyptianMau",
		"t4j.typeinfo.pets.Manx",
		"t4j.typeinfo.pets.Cymric",
		"t4j.typeinfo.pets.Rat",
		"t4j.typeinfo.pets.Mouse",
		"t4j.typeinfo.pets.Hamster"
	};
	
	
	@SuppressWarnings("unchecked")
	private static void loader(){
		
		for(String name : typeNames)
			try {
				types.add((Class<? extends Pet>)Class.forName(name) );//使用转型，会产生编译器警告
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}
	
	static{ loader();}


	@Override
	public List<Class<? extends Pet>> types() {
		
		return types;
	}
	
	
}
